

if [ x$1 = x'v7' ] ; then
    echo 'arm7'
    mkdir build_v7
    cd build_v7
    export SYSROOT=$NDK/platforms/android-21/arch-arm
    export PATH=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
    export CC="arm-linux-androideabi-gcc --sysroot=$SYSROOT"
    export CXX="arm-linux-androideabi-g++  --sysroot=$SYSROOT"
    ../configure --prefix=$PWD/install CFLAGS='-DANDROID  -fPIC' --host arm-linux-androideabi
else if [ x$1 = x'v8' ] ; then
    echo 'arm8'
    mkdir -p build_v8
    cd build_v8
    export SYSROOT=$NDK/platforms/android-21/arch-arm64
    export PATH=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin:$PATH
    export CC="aarch64-linux-android-gcc --sysroot=$SYSROOT"
    export CXX="aarch64-linux-android-g++  --sysroot=$SYSROOT"
    ../configure --prefix=$PWD/install CFLAGS='-DANDROID -fPIC' --host=aarch64-linux-android --disable-libudev
else if [ x$1 = x'64' ] ; then
    echo 'x86_64'
    mkdir build_x86
    cd build_x86
    export SYSROOT=$NDK/platforms/android-21/arch-x86_64
    export PATH=$NDK/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin:$PATH
    export CC="x86_64-linux-android-gcc --sysroot=$SYSROOT"
    export CXX="x86_64-linux-android-g++  --sysroot=$SYSROOT"
    ../configure --prefix=$PWD/install CFLAGS='-DANDROID -fPIC' --host=x86_64-linux-android
fi
fi
fi
make clean && make
cd -
exit
